#include "../include/print2file.h"


    print2file::print2file(string fileName){
        print.open(fileName.c_str());
        if(!print.is_open()){
            cout<<"sorry can not open output file, "<<fileName<<endl;
            exit(1);
        }
    }

    void print2file::open(string fileName){
        print.open(fileName.c_str());
        if(!print.is_open()){
            cout<<"sorry can not open output file, "<<fileName<<endl;
            exit(1);
        }
    }

    void print2file::printprediction(int nCustID, short nMovieID, short nPrediction, short nSeen){
        print<<nMovieID<<","<<nCustID<<","<<nPrediction<<","<<nSeen<<endl;
    }

    void print2file::printvector(vector<int> vec){
        for(int i =0; i < vec.size(); i++){
            print<<vec[i]<<endl;
        }
    }

    print2file::~print2file(){
        print.close();
    }
